package com.atwisdom.star.serviceController.equipPoint;

import com.alibaba.fastjson.JSONObject;
import com.atwisdom.star.common.vo.ResultInfo;
import com.atwisdom.star.exception.pojo.BusinessException;
import com.atwisdom.star.log.aop.StarAnnotation;
import com.atwisdom.star.service.equipPoint.EquipPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: EquipPointServiceController
 * @ Description:   设备采集点
 * @author: wjj
 * @date: 2024/7/17
 */
@RestController
@RequestMapping("/equipPoint")
public class EquipPointServiceController {

    @Autowired
    private EquipPointService equipPointService;


    /**
     * 根据设备id查询logic容器存在返回不存在新增
     */
    @StarAnnotation
    @PostMapping("/queryEquipPointByEquId")
    public ResultInfo<?> queryEquipPointByEquId(@RequestBody JSONObject data) throws BusinessException {
        return equipPointService.queryEquipPointByEquId(data);
    }

    @StarAnnotation
    @PostMapping("/isEquipHasContent")
    public ResultInfo<?> isEquipHasContent(@RequestBody JSONObject data) throws BusinessException {
        return equipPointService.isEquipHasContent(data);
    }

    /**
     * 新增采集点并加入设备容器
     */
    @StarAnnotation
    @PostMapping("/addCollectionPoint")
    public ResultInfo<?> addCollectionPoint(@RequestBody JSONObject data) throws BusinessException {
        return equipPointService.addCollectionPoint(data);
    }

    /**
     * 已有采集点加入设备容器
     */
    @StarAnnotation
    @PostMapping("/linkCollectionPoint")
    public ResultInfo<?> linkCollectionPoint(@RequestBody JSONObject data) throws BusinessException {
        return equipPointService.linkCollectionPoint(data);
    }
}